package com.usian.admin.controller.v1;

import com.usian.admin.service.SensitiveService;
import com.usian.apis.admin.v1.SensitiveControllerApi;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.PageResponseResult;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @创建人 lingyin
 * @创建时间 2022/10/10
 * @描述
 */
@RestController
@RequestMapping("api/v1/sensitive")

public class SensitiveController implements SensitiveControllerApi {

    @Autowired
    SensitiveService sensitiveService;
    /**
     * @param sensitiveDto
     * @描述 查询所有带分页
     * @参数 size page name
     * @返回值 PageResponseResult
     */
    @Override
    @PostMapping("/findAll")
    public PageResponseResult findAll(@RequestBody SensitiveDto sensitiveDto) {
        return sensitiveService.findAll(sensitiveDto);
    }

    /**
     * @param adSensitive
     * @return ResponseResult
     * @描述 添加
     * @params adChannel
     */
    @Override
    @PostMapping("/add")
    public ResponseResult add(@RequestBody AdSensitive adSensitive) {
        return sensitiveService.add(adSensitive);
    }

    /**
     * @param id
     * @return ResponseResult
     * @描述 修改回显
     * @params id
     */
    @Override
    @GetMapping("/findById/{id}")
    public ResponseResult findById(@PathVariable Integer id) {
        return sensitiveService.findById(id);
    }

    /**
     * @param adSensitive
     * @return ResponseResult
     * @描述 修改
     * @params adChannel
     */
    @Override
    @PutMapping("/update")
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return sensitiveService.update(adSensitive);
    }

    /**
     * @param id
     * @return ResponseResult
     * @描述 删除
     * @params id
     */
    @Override
    @DeleteMapping("/delete/{id}")
    public ResponseResult delete(@PathVariable Integer id) {
        return sensitiveService.delete(id);
    }

    /**
     * @param ids
     * @return ResponseResult
     * @描述 批量删除敏感词信息
     * @params [ids]
     */
    @Override
    @PostMapping("/deletes")
    public ResponseResult deletes(@RequestBody Integer[] ids) {
        return sensitiveService.deletes(ids);
    }
}
